<include file="Public:header" />
<style type="text/css">
    ul{
        margin: 0px;
        padding:0px;
    }
    #attr{

        disabled:disabled;

    }
    ul li{
        list-style: none;
        margin-bottom: 15px;
    }
</style>

<script src="__JS__/ueditor/ueditor.config.js"></script>
<script src="__JS__/ueditor/ueditor.all.js"></script>
<!-- main content start-->
<div class="main-content" >

    <!-- header section start-->
    <div class="header-section">

        <!--toggle button start-->
        <a class="toggle-btn"><i class="fa fa-bars"></i></a>
        <!--toggle button end-->

        <!--notification menu start -->
        <div class="menu-right">
            <ul class="notification-menu" style="margin-top: 15px;">
                <li>
                <span class="span" style="margin-top: 100px;"><!-- data-toggle="dropdown"-->
                    账户余额(元)<span style="color: red; font-size: 16px; font-weight: 800 ">{$info.money}</span>
                </span>
                </li>

            </ul>
        </div>
        <!--notification menu end -->

    </div>
    <!-- header section end-->
    <!-- page heading start-->
    <div class="page-heading">
        <h3>活动管理</h3>
        <ul class="breadcrumb">
            <li>
                <a href="#">首页</a>
            </li>
            <li> 活动管理 </li>
            <li class="active"> 添加活动 </li>
        </ul>
    </div>
    <!-- page heading end-->
    <!--body wrapper start-->

    <div class="wrapper">
        <div class="row">
            <form class="form-horizontal" enctype="multipart/form-data" method="post" id="sub">
            <div class="col-md-12">
                <section class="panel">
                    <header class="panel-heading">
                        活动信息
                        <span class="tools pull-right">
                             </span>
                    </header>
                    <div class="panel-body">
                            <div class="form-group" style="margin-top: 10px;">
                                <label class="col-md-2 col-sm-2 control-label">活动标题</label>
                                <div class="col-md-6 col-sm-6">
                                    <input type="text" name="title" id="title" class="form-control" placeholder="活动标题" value="{$info.title}">
                                </div>
                            </div>
                        <div class="form-group" style="height: 300px;">
                            <label class="col-md-2 col-sm-2 control-label">活动说明</label>
                            <div class="col-md-6 col-sm-6">
                                <textarea id="content" name="content"   type="text/plain "></textarea>
                                <script>
                                    var ue = UE.getEditor('content');
                                  </script>
                            </div>
                        </div>

                        <div class="form-group" style="margin-top: 10px;">
                            <label class="col-md-2 col-sm-2 control-label">活动限额</label>
                            <div class="col-md-6 col-sm-6">
                                <input type="text" name="quota_money" id="quota_money" class="form-control" placeholder="活动限额" >
                            </div>
                        </div>

                            <div class="form-group">
                                <label class="col-md-2 col-sm-2 control-label">最小红包金额</label>
                                <div class="col-md-6 col-sm-6">
                                    <input type="text" name="money" id="money" class="form-control" placeholder="最小红包金额" >
                                </div>
                            </div>

                        <div class="form-group">
                            <label class="col-md-2 col-sm-2 control-label">最大红包金额</label>
                            <div class="col-md-6 col-sm-6">
                                <input type="text" name="max_money" id="max_money" class="form-control" placeholder="最大红包金额">
                            </div>
                        </div>


                        <div class="form-group">
                            <label class="col-md-2 col-sm-2 control-label">图片</label>
                            <div class="col-md-6 col-sm-6">

                                <input type="file" name="image" id="image" class="form-control">
                                <span class="span" style="color: red">建议图片大小720*1280</span>
                            </div>
                        </div>
                    </div>
                </section>
            </div>
                <div class="panel-body">
                    <div class="form-group" style="margin-top: 10px;">
                        <div class="col-md-6 col-sm-6">
                            <button type="submit" class="btn btn-default" style="margin-left: 50%">提交</button>
                        </div>
                    </div>
                </div>

            </form>

        </div>

    </div>
    <!--body wrapper end-->
    <!-- main content end-->
    <script src="__JS__/bootstrap.min.js"></script>
    <script>


            $("form").submit(function () {
                var content=ue.getContent();
                if ($("#title").val() == "") {
                    toast("二维码标题不得为空", false);
                    return false;
                }
                if (content == "") {
                    toast("二维码说明不得为空", false);
                    return false;
                }
                if ($("#quota_money").val() == "" || $("#quota_money").val() <= 0) {
                    toast("活动限额不得为空且不能小于0", false);
                    return false;
                }

                if ($("#money").val() == "" || $("#money").val() <= 0) {
                    toast("红包最小金额不得为空且钱数不能小于0", false);
                    return false;
                }
                if ($("#max_money").val() == "" || $("#max_money").val() <= 0 || $("#max_money").val() <= $("#money").val()) {
                    toast("红包最大金额不得为空且钱数不能小于0,并且红包最大金额不能小于红包最小金额", false);
                    return false;
                }
                if ($("#image").val() == "") {
                    toast("请上传图片", false);
                    return false;
                }
            });


    /*        var url = "{:U('/Shopadmin/Code/add_code')}";
            $.post(url, function(res){
                if(res.code===200){
                    toast(res.msg, true);
                    window.location.href = "{:U('/Shopadmin/code/code_list')}";
                }else{
                    toast(res.msg, false);
                }
            });
            return false;
        });*/
    </script>
    <include file="Public:footer" />